package com.hiyee.api.controller.user;

import com.hiyee.grace.result.ResponseJsonResult;
import com.hiyee.pojo.bo.RegisterLoginBO;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import org.springframework.validation.BindingResult;
import org.springframework.web.bind.annotation.*;

import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.validation.Valid;

@Api(value = "用户通行证接口", tags = {"用户通行证接口"})
@RequestMapping("passport")
public interface PassportControllerApi {

    /**
     * Api 只定义接口，具体实现由相应的服务层实现
     * 方便微服务的统一调度和管理
     *
     * 本工程的目标就是定义规范、解耦
     *
     * swagger2 基于接口自动文档生成
     *
     * 提高项目可扩展性
     *
     * @return
     */
    @ApiOperation(value = "获取短信验证码", notes = "获取短信验证码", httpMethod = "GET")
    @GetMapping("/getSmsCode")
    public Object getSmsCode(@RequestParam String mobile, HttpServletRequest request);

    @ApiOperation(value = "一键登录注册接口", notes = "一键登录注册接口", httpMethod = "POST")
    @PostMapping("/login")
    public Object login(@RequestBody @Valid RegisterLoginBO registerLoginBO, BindingResult bindingResult, HttpServletRequest request, HttpServletResponse response);

    @ApiOperation(value = "用户退出登录", notes = "用户退出登录", httpMethod = "POST")
    @PostMapping("/logout")
    public ResponseJsonResult logout(String userId, HttpServletRequest request, HttpServletResponse response);
}
